<html>
<head><meta charset="utf-8"><title>x.py run single unit test? · general · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/index.html">general</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/x.2Epy.20run.20single.20unit.20test.3F.html">x.py run single unit test?</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="214103147"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/x.py%20run%20single%20unit%20test%3F/near/214103147" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Nelson J Morais <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/x.2Epy.20run.20single.20unit.20test.3F.html#214103147">(Oct 21 2020 at 19:34)</a>:</h4>
<p>is it possible with <code>x.py</code> (or directly with cargo) to run a single unit test ? ex. run only a single test fn on file <code>library/core/tests/cmp.rs</code>, or even just the testcases inside <code>cmp.rs</code> file?</p>



<a name="214105349"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/x.py%20run%20single%20unit%20test%3F/near/214105349" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> tm <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/x.2Epy.20run.20single.20unit.20test.3F.html#214105349">(Oct 21 2020 at 19:51)</a>:</h4>
<p>./x.py test library/core/ --test-args test_ord_min_max_by_key</p>



<a name="214107842"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/x.py%20run%20single%20unit%20test%3F/near/214107842" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Nelson J Morais <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/x.2Epy.20run.20single.20unit.20test.3F.html#214107842">(Oct 21 2020 at 20:08)</a>:</h4>
<p>thanks tm!<br>
i've passed over <code>--help</code>, but didn't realise that flag was for cargo args.. <span aria-label="face palm" class="emoji emoji-1f926" role="img" title="face palm">:face_palm:</span></p>
<div class="codehilite" data-code-language=".."><pre><span></span><code>        --test-args ARGS
                        extra arguments
        --rustc-args ARGS
                        extra options to pass the compiler when running tests
</code></pre></div>



<a name="214108102"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/x.py%20run%20single%20unit%20test%3F/near/214108102" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Nelson J Morais <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/x.2Epy.20run.20single.20unit.20test.3F.html#214108102">(Oct 21 2020 at 20:10)</a>:</h4>
<p>we could enhance that description to something along the lines of the <code>--rust-args</code>, like "extra arguments to pass to cargo when running tests"</p>



<a name="214125319"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/x.py%20run%20single%20unit%20test%3F/near/214125319" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/x.2Epy.20run.20single.20unit.20test.3F.html#214125319">(Oct 21 2020 at 22:56)</a>:</h4>
<p>sounds like a good change :) are you interested in making a PR?</p>



<a name="214125333"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/x.py%20run%20single%20unit%20test%3F/near/214125333" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/x.2Epy.20run.20single.20unit.20test.3F.html#214125333">(Oct 21 2020 at 22:56)</a>:</h4>
<p>the help message there is in <code>src/bootstrap/flag.rs</code> I think</p>



<a name="214217457"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/x.py%20run%20single%20unit%20test%3F/near/214217457" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Nelson J Morais <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/x.2Epy.20run.20single.20unit.20test.3F.html#214217457">(Oct 22 2020 at 17:08)</a>:</h4>
<p>yes, will gladly do that hopefully later today. can I ping your if I need help, or for PR review?</p>



<a name="214221786"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/x.py%20run%20single%20unit%20test%3F/near/214221786" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/x.2Epy.20run.20single.20unit.20test.3F.html#214221786">(Oct 22 2020 at 17:41)</a>:</h4>
<p>absolutely :) I might not get to it today but certainly by the weekend</p>



<a name="214230970"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/x.py%20run%20single%20unit%20test%3F/near/214230970" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Nelson J Morais <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/x.2Epy.20run.20single.20unit.20test.3F.html#214230970">(Oct 22 2020 at 18:46)</a>:</h4>
<p>great, yeah. no pressure I have time! <span aria-label="smile" class="emoji emoji-1f642" role="img" title="smile">:smile:</span> <br>
PR opened #<a href="https://github.com/rust-lang/rust/pull/78243">78243</a></p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>